import { defineConfig} from 'vite';
import vue from '@vitejs/plugin-vue';
import {join} from 'path';
import eslintPlugin from 'vite-plugin-eslint';
export default defineConfig({
	build: {
		rollupOptions: {
			output: {
				manualChunks: (id) => {
					console.log(id);
					if(id.includes('node_modules/@vue')){
						return 'vue';
					}else if (id.includes('node_modules')) {
						return 'vendor';
					}
					
				}
			}
		}
	},
	server: {
		host: '0.0.0.0',
		port: 8000
	},
	preview: {
		host: '0.0.0.0',
		port: 8000
	},
	plugins: [
		vue(),
		eslintPlugin({
			include: ['src/**/*.js', 'src/**/*.vue'],
			fix: true,
			cache: true,
		}),
	],
	resolve: {
		extensions: ['.js', '.vue', '.json', '.ts'],
		alias: [
			{find: '@', replacement: join(__dirname, './src')},
		]
	}
});
